package com.hz.framework.util;

public final class CharacterDispose {
	
	/**
	 * 替换分隔字符串中的数据
	 * 
	 * @param  String arg0  字符参数
	 * @return String arg0 处理后的字符串
	 * */
	public static final String doReplace(String arg0){
		if(arg0 != null){
			if("where".equals(arg0.trim().toLowerCase())){
				arg0 ="";
			}else if("and".equals(arg0.trim().toLowerCase())){
				arg0 ="";
			}else if("or".equals(arg0.trim().toLowerCase())){
				arg0 ="";
			}else if("like".equals(arg0.trim().toLowerCase())){
				arg0 ="";
			}else if("between".equals(arg0.trim().toLowerCase())){
				arg0 ="";
			}
		}else{
			arg0 ="";
		}
		return arg0;
	}
	
	/**
	 * 替换SQL语句中WHERE字符串中的数据
	 * 
	 * @param  String arg0  字符参数
	 * @return String arg0 处理后的字符串
	 * */
	public static final String doReplaceWhere(String arg0){
		if(arg0 != null)
			arg0 = arg0.replace("/%", "");
		else
			arg0 ="";
		return arg0;
	}
	
	public static String trimZero(String str) {
		//去掉金钱后面的0
		//如10.00000010000变成10.0000001
		//10.000000变成10
		if(str==null || str.equals(""))
		{
			return str;
		}		
		if (str.indexOf(".") != -1 && str.charAt(str.length() - 1) == '0') {
			return trimZero(str.substring(0, str.length() - 1));
		} else {
			return str.charAt(str.length() - 1) == '.' ? str.substring(0, str.length() - 1) : str;
		}
	}
}
